﻿Imports System.Windows.Data
Imports System.Windows

''' <summary>
''' 
''' </summary>
''' <remarks></remarks>
Public Class TypeNameConverter
    Implements IValueConverter
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Function Convert(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.Convert
        If targetType IsNot GetType(String) Then _
            Throw New InvalidOperationException("La cible doit être de type System.String")
        Try
            Select Case CType(value, String)
                Case "String"
                    Return "Caractères"
                Case "Double"
                    Return "Numériques"
                Case "DateTime"
                    Return "Dates"
                Case Else
                    Return New String("")
            End Select
        Catch ex As Exception
            Return DependencyProperty.UnsetValue
        End Try
    End Function
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Function ConvertBack(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.ConvertBack
        Throw New NotImplementedException()
    End Function
End Class
